/***********************************************************************
filename:   hgeApplication.h
created:    24/9/2004
author:     Paul D Turner
*************************************************************************/

#ifndef _hgeApplication_h_
#define _hgeApplication_h_

#include "hgeGeometryBuffer.h"

#if defined( __WIN32__ ) || defined( _WIN32 )
#   define WIN32_LEAN_AND_MEAN
#   include <windows.h>
#endif

//Updated for linking of static libs
#pragma comment(lib, "d3d9.lib")
struct hgeBaseApplicationImpl;
class hgeBaseSample;

class hgeApplication
{
public:
	hgeApplication();
	~hgeApplication();

	// Implementation of base class abstract methods.
	bool execute(hgeBaseSample* sampleApp);
	void cleanup();
	void initialiseResourceGroupDirectories();
	void setQuitting(bool quit = true)      { d_quitting = quit; }
	bool isQuitting() const     { return d_quitting; }

protected:
	//Initialises Direct3D system.
	bool initialiseDirect3D(unsigned int width, unsigned int height, unsigned int adapter, bool windowed);

	//Do reset of Direct3D device
	bool resetDirect3D(void);

	void doFPSUpdate(void);

	bool overlayHandler(const EventArgs& args);

	/*************************************************************************
	Data fields
	*************************************************************************/
	hgeBaseApplicationImpl* pimpl;;

	// counter used to track elapsed time (for time pulse injection)
	DWORD d_lastFrameTime;
	// FPS stuff
	DWORD d_fps_lastTime;
	int d_fps_frames;
	int d_fps_value;
	char d_fps_textbuff[16];
	GeometryBuffer* d_fps_geometry;
	GeometryBuffer* d_logo_geometry;
	
	bool d_quitting;     //!< true when the base app should cleanup and exit.
};

#endif  // end of guard _hgeApplication_h_
